Pretty easy stuff to install
Fire following commands
# wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
# tar xvfz ImageMagick.tar.gz
[It will create the folder ]
# cd ImageMagick-6.?.?
# ./configure
# make
# make install
Test it
For resizing
# /usr/local/bin/convert -resize 100X100 marmik1.png marmik_thum.png
For converting
# /usr/local/bin/convert marmik1.png marmik1.gif
How to Run with PHP?
Refer my previous post http://vikrant_labde.blogspot.com/2008/02/run-ffmepg-command-with-php.html get the php function form there of ur exec() or system() command failed.
runExternal("/usr/local/bin/convert -resize 100X100 marmik1.png marmik_thum.png", $code );
if($code != "") print "its error mate";
?>
More functions
http://www.imagemagick.org/script/convert.php
Saturday, October 11, 2008
Monday, October 06, 2008
TinyMCE for specific textareas
As per example code of the tinyMCE, its convert all Textareas on the HTML pages into
WYSIWUG editor, which is really stupid stuff by them though.
I have searched a lot about allowing tinyMCE for particular Textareas on the page and its really a common discussion topic on the forum but I haven't got any satisfactory answer. I dont know why all answers are only for Dupal implementation grrrrrrrrr.
Then I looked into tiny_mce.js and I found something like "spefic_textarea" and I searched into tinyMCE manual for this keyword (http://wiki.moxiecode.com/index.php/Special:Search?ns100=1&ns106=1&ns108=1&search=specific_textareas&searchx=Search) and found some help.
Heres is code which will solve your problem.
tinyMCE.init({
// General options
mode : "exact",
elements : "textarea_id1,textarea_id2", // just pass the ID's of your textarea for which you
// want to add the editor
// Your code related other settings, keep it same
cheers..
WYSIWUG editor, which is really stupid stuff by them though.
I have searched a lot about allowing tinyMCE for particular Textareas on the page and its really a common discussion topic on the forum but I haven't got any satisfactory answer. I dont know why all answers are only for Dupal implementation grrrrrrrrr.
Then I looked into tiny_mce.js and I found something like "spefic_textarea" and I searched into tinyMCE manual for this keyword (http://wiki.moxiecode.com/index.php/Special:Search?ns100=1&ns106=1&ns108=1&search=specific_textareas&searchx=Search) and found some help.
Heres is code which will solve your problem.
tinyMCE.init({
// General options
mode : "exact",
elements : "textarea_id1,textarea_id2", // just pass the ID's of your textarea for which you
// want to add the editor
// Your code related other settings, keep it same
cheers..
Wednesday, July 30, 2008
QueryString in .htaccess - Match Question Mark in rewrite rule
I am changing my development structure to have rewrite urls for fuse/action
and I thought it's cool if I represent all URLs like google (http://www.google.co.in/search?hl=en&client=firefox-a)
so http://mysite.com?index.php?action=search&q=vikrant should look like http://mysite.com/search?q=vikrant
for this purpose I have first tried a simple rule to match anything after "/".
RewriteEngine On
RewriteRule ^(.*)$ index.php?action=$1 [L]
but when I print GET variables then it s only giving me the part before "?" (that was strange)
Then after googling a bit I just got the hint that Mod Rewrite do not matches string after "?"
because it's treating it as %{QUERYSTRING}, hence I have created following rule to achieve the result which is running perfect for me
RewriteEngine On
RewriteRule ^/?([^/][^\./]*)[:;,\.]*$ index.php?action=$1&%{QUERY_STRING} [L]
and I thought it's cool if I represent all URLs like google (http://www.google.co.in/search?hl=en&client=firefox-a)
so http://mysite.com?index.php?action=search&q=vikrant should look like http://mysite.com/search?q=vikrant
for this purpose I have first tried a simple rule to match anything after "/".
RewriteEngine On
RewriteRule ^(.*)$ index.php?action=$1 [L]
but when I print GET variables then it s only giving me the part before "?" (that was strange)
Then after googling a bit I just got the hint that Mod Rewrite do not matches string after "?"
because it's treating it as %{QUERYSTRING}, hence I have created following rule to achieve the result which is running perfect for me
RewriteEngine On
RewriteRule ^/?([^/][^\./]*)[:;,\.]*$ index.php?action=$1&%{QUERY_STRING} [L]
Saturday, May 31, 2008
No vhost.conf in httpd.include OR Changing default DocumentRoot directory
I have Plesk installed as server management tool and I wanted to point multiple site to
single DocumentRoot for that purpose I opend httpd.include (for plesk normally present
in /var/www/vhsots//conf). There was a note that you should over ride the
setting in vhost.conf if u want, but there was no vhost.conf in the /conf directory
hence I created it (vi vhost.conf) and enter following code in it
DocumentRoot /path/to/new/documentroot
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/path/to/new/documentroot:/tmp"
and restarted my server, but changes didnt reflect hence I googled and found following
solution.
If you dont find following "Include /var/www/vhosts/conf/conf/vhost.conf " line
in httpd.include then run following command
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com
Plesk will add "Include" statement in httpd.include
And restart the server (service httpd restart OR /etc/init.d/httpd restart)
And Cheers..
---
I have found one more solution which is I can say technical cheating :) by creating
symbolic link
you remove any custom changes in your vhost.conf file and remove or rename the httpdocs directory entirely.
Then you run ln -s /path/to/new/documentroot httpdocs which will create the link.
This way Apache will still read from /path/to/old/documentroot and all the
settings will apply correctly, but the files are actually stored on the new path.
single DocumentRoot for that purpose I opend httpd.include (for plesk normally present
in /var/www/vhsots/
setting in vhost.conf if u want, but there was no vhost.conf in the /conf directory
hence I created it (vi vhost.conf) and enter following code in it
DocumentRoot /path/to/new/documentroot
php_admin_flag engine on
php_admin_flag safe_mode on
php_admin_value open_basedir "/path/to/new/documentroot:/tmp"
and restarted my server, but changes didnt reflect hence I googled and found following
solution.
If you dont find following "Include /var/www/vhosts/conf/
in httpd.include then run following command
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=yourdomain.com
Plesk will add "Include" statement in httpd.include
And restart the server (service httpd restart OR /etc/init.d/httpd restart)
And Cheers..
---
I have found one more solution which is I can say technical cheating :) by creating
symbolic link
you remove any custom changes in your vhost.conf file and remove or rename the httpdocs directory entirely.
Then you run ln -s /path/to/new/documentroot httpdocs which will create the link.
This way Apache will still read from /path/to/old/documentroot and all the
settings will apply correctly, but the files are actually stored on the new path.
Friday, February 29, 2008
Run ffmpeg command with php
Hi,
In my last article I have tackled the problem for ffmpeg
installation when u dont have YUM installed on your server,
on same day I have again faced problem with execution of
ffmpeg commands from php and I have found below solution
for this on google
array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("pipe", "w") // stderr is a file to write to
);
$pipes= array();
$process = proc_open($cmd, $descriptorspec, $pipes);
$output= "";
if (!is_resource($process)) return false;
#close child's input imidiately
fclose($pipes[0]);
stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);
$todo= array($pipes[1],$pipes[2]);
while( true ) {
$read= array();
if( !feof($pipes[1]) ) $read[]= $pipes[1];
if( !feof($pipes[2]) ) $read[]= $pipes[2];
if (!$read) break;
$ready= stream_select($read, $write=NULL, $ex= NULL, 2);
if ($ready === false) {
break; #should never happen - something died
}
foreach ($read as $r) {
$s= fread($r,1024);
$output.= $s;
}
}
fclose($pipes[1]);
fclose($pipes[2]);
$code= proc_close($process);
return $output;
}
Monday, February 25, 2008
How to Install ffmpeg?
Hi Folks,
I have spent hell three hours on finding the quick ffmpeg installer, and on my system YUM is also not working
I guess this similar kind of problem will be there with you also. Following are the easy stpes to install FFMPEG on your sever
My System is RedHat EL 4.
FFMPEG installation for RedHat EL 4 - i386
This installation will run probably for all i386 systems.
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/ffmpeg-0.4.9-0.9.20070530.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libogg0-1.1.3-7.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/gsm-1.0.10-6.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libmp3lame0-3.97-16.el4.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libvorbis0-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/libvorbisenc2-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/xvidcore-1.1.3-1.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/x264-0.0.0-0.4.20070529.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libfaac0-1.25-2.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/faad2-2.5-7.el4.at.i386.rpm
Get sample MPEG file
wget http://www.fileformat.info/format/mpeg/sample/031699cb978244b8a3adf1e81cb2ac7c/FORM.MPG
Convert MPEG from FLV
ffmpeg -i FORM.MPG -ar 22050 -ab 32 -f flv -s 320x240 -aspect 4:3 -y
Convert IMAGE From FLV
ffmpeg -i FORM.flv -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -s 320×240 -vcodec mjpeg -f mjpeg form.jpg
RPMS Taken From
http://rpm.pbone.net/
ffmpeg help Articles
http://ffmpeg.mplayerhq.hu/faq.html
http://www.luar.com.hk/blog/?p=670
I have spent hell three hours on finding the quick ffmpeg installer, and on my system YUM is also not working
I guess this similar kind of problem will be there with you also. Following are the easy stpes to install FFMPEG on your sever
My System is RedHat EL 4.
FFMPEG installation for RedHat EL 4 - i386
This installation will run probably for all i386 systems.
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/ffmpeg-0.4.9-0.9.20070530.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libogg0-1.1.3-7.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/gsm-1.0.10-6.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libmp3lame0-3.97-16.el4.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libvorbis0-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/libvorbisenc2-1.1.2-5.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/RPMS.dag/xvidcore-1.1.3-1.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el4/en/i386/dag/RPMS/x264-0.0.0-0.4.20070529.el4.rf.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libfaac0-1.25-2.el4.at.i386.rpm
# rpm -Uvh --nodeps ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/faad2-2.5-7.el4.at.i386.rpm
Get sample MPEG file
wget http://www.fileformat.info/format/mpeg/sample/031699cb978244b8a3adf1e81cb2ac7c/FORM.MPG
Convert MPEG from FLV
ffmpeg -i FORM.MPG -ar 22050 -ab 32 -f flv -s 320x240 -aspect 4:3 -y
Convert IMAGE From FLV
ffmpeg -i FORM.flv -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -s 320×240 -vcodec mjpeg -f mjpeg form.jpg
RPMS Taken From
http://rpm.pbone.net/
ffmpeg help Articles
http://ffmpeg.mplayerhq.hu/faq.html
http://www.luar.com.hk/blog/?p=670
Labels:
ffmpeg,
ffmpeg for i386,
ffmpeg for redhat EL4,
install ffmpeg
Subscribe to:
Posts (Atom)